<?php
require_once(__DIR__.'/analysis/api.php');
require_once(__DIR__.'/caching/FileCache.php');
require_once(__DIR__.'/analysis/permissions.php');
require_once(__DIR__.'/analysis/orm.php');
require_once(__DIR__.'/analysis/web.php');

class doc {

    /**
     * @var doc\analysis\api
     */
    public  static  $api = null;

    /**
     * @var doc\analysis\permissions
     */
    public  static  $permission =  null;

    /**
     * @var doc\caching\FileCache
     */
    public  static  $cache =  null;

    /**
     * @var doc\analysis\Orm
     */
    public static $orm = null;

    /**
     * @var doc\analysis\web
     */
    public static $web = null;

    /**
     * doc constructor.
     * @param bool $encrypt：缓存文件加密
     */
    public function __construct()
    {
        static::$api  = new doc\analysis\api();

        static::$permission  = new doc\analysis\permissions();

        static::$cache = new doc\caching\FileCache();

        static::$orm = new doc\analysis\Orm();

        static::$web = new doc\analysis\web();

    }
}


//自动加载：
//spl_autoload_register(function ($name) {
//
//    $path = dir(__DIR__)->path;
//
//    list($nameSpace,$nameSpaceTwo, $class) = explode("\\", $name);
//    $basePath = substr($path, 0, strlen($path)-strlen($nameSpace));
//    $classPath = $basePath.str_replace('\\', "/", $name).'.php';
//
//
//    try {
//        if (in_array($class, ['api', 'permissions', 'FileCache']))
//            require_once ($classPath);
//
//    } catch (Exception $e) {
//        echo "你没有定义：{$name}类:".$e->getMessage();
//    }
//
//});

new doc();